<?php
include_once('./inc/config.php');
if(!is_logged_in()) redirect('index.php');	

$id = (int) $_GET['id'];

if(!empty($id)){
	$actions = get_domain_info($id);
}

/** 
 * Get all domains
 *
 * @descp Get all domains based on the user id
 * @access public
 * @param  NA	 
 * @return void
 */
function get_domain_info($id = 0)
{
	global $dbobj, $proj_config;
	$set = array();
	$id = (int) $id;
	$query = "SELECT *, c_code as web_code
				FROM `domains`
				WHERE 	user_id  = '".$_SESSION['user_id']."'	
				AND d_id = '".$id."'
				";
		
	// Perform Query
	$result = $dbobj->MySQLDB_GetData($query);
	
	// Gwet num rows from the result set	
	$no_rows = $dbobj->MySQLDB_Numrows();	
			
	if($no_rows > 0)
	{	
		// Use result
		$set = $result;
	}	
	return $set;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $proj_config['project_name']; ?></title>
<link type="text/css" rel="stylesheet" href="<?php echo $proj_config['site_url']; ?>css/master.css" />
<link type="text/css" rel="stylesheet" href="<?php echo $proj_config['site_url']; ?>css/reset.css" />
<script type="text/javascript" language="javascript">
var site_url = '<?php echo $proj_config['site_url']; ?>';
</script>
<script type="text/javascript" language="javascript" src="<?php echo $proj_config['site_url']; ?>js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo $proj_config['site_url']; ?>js/common.js"></script>
</head>

<body>
<div class="pw_text">
	<form class="frm" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
	<?php if(isset($actions['d_name']) && !empty($actions['d_name']) && !empty($actions['web_code'])){ 
	include(BASEPATH . 'views/webcode.php');
	?>
	<br/>
	<input type="button" name="btn_close_win" id="btn_close_win" value="" title="Close Window" class="btnd close_btn" onclick="javascript:window.close();"/>
	<?php }else{ ?>
	Sorry no domain information was found.<br/>
	<a href="javascript:;" onclick="javascript:window.close();" class="btnd close_btn"></a>
	<?php } ?>
	
	</form>
</div>
<div id="e_footer"></div>
</body>
</html>
